﻿using HamcoWcs.Entitys.Bases;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace HamcoWcs.Entitys.PalletInfos
{
    public class PalletInfo : BaseEntity, IEntityTypeConfiguration<PalletInfo>
    {
        public string UnitId { get; set; }
        public string MaterialInfo { get; set; }
        public string MachineName { get; set; }
        public string PortName { get; set; }
        public string Size { get; set; }
        public string SettingCode { get; set; }
        public string OrderNumber { get; set; }
        public string PalletType { get; set; }
        public string PalletStatus { get; set; }


        public void Configure(EntityTypeBuilder<PalletInfo> builder)
        {
            builder.HasComment("托盘信息");
            builder.Property(x => x.UnitId).IsRequired().HasMaxLength(50).HasComment("托盘号");
            builder.Property(x => x.MaterialInfo).IsRequired(false).HasDefaultValue("").HasMaxLength(10240).HasComment("物料信息");
            builder.Property(x => x.MachineName).IsRequired(false).HasDefaultValue("").HasMaxLength(50).HasComment("设备名");
            builder.Property(x => x.PortName).IsRequired(false).HasDefaultValue("").HasMaxLength(50).HasComment("设备名Port口");
            builder.Property(x => x.Size).IsRequired(false).HasDefaultValue("").HasMaxLength(50).HasComment("尺寸");
            builder.Property(x => x.SettingCode).IsRequired(false).HasDefaultValue("").HasMaxLength(50).HasComment("尺寸代码");
            builder.Property(x => x.OrderNumber).IsRequired(false).HasDefaultValue("").HasMaxLength(100).HasComment("预留单号");
            builder.Property(x => x.PalletType).IsRequired(false).HasDefaultValue("").HasMaxLength(100).HasComment("栈板类型");
            builder.Property(x => x.PalletStatus).IsRequired(false).HasDefaultValue("").HasMaxLength(100).HasComment("栈板状态");

            builder.HasIndex(x => x.UnitId).IsUnique();
        }
    }
}
